﻿#region Imports
using System;
using System.Globalization;
using System.Windows.Data;
#endregion Imports

namespace PlayRandom.Converters
{
    public class SizeConverter : IValueConverter
    {
        #region IValueConverter Members
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            double size = -1, deflection = -1;
            Double.TryParse(System.Convert.ToString(value), out size);
            Double.TryParse(System.Convert.ToString(parameter), out deflection);

            return size + deflection;
        }

        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            throw new NotImplementedException();
        }
        #endregion IValueConverter Members
    }
}
